﻿<%@ Page Title="" Language="C#" MasterPageFile="~/ANMCMaster.Master" AutoEventWireup="true" CodeBehind="WorshipHome.aspx.cs" Inherits="AllNations.WorshipHome" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ANHeaderContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ANPageHeader" runat="server">
    <asp:Image runat="server" ImageUrl="~/Images/worship_main.png" />
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ANBodyContent" runat="server">
    <telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="radMenuLeftNav" EventName="ItemClick">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="ANMCPageViews" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManagerProxy>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server"></telerik:RadAjaxLoadingPanel>
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
            function ddSermonSeries_SelectedIndexChanged(sender) {
                var panelNewSeries = document.getElementById('<%= panelNewSeries.ClientID %>');
                if (sender.value == "AddNew") {
                    if (panelNewSeries != null) {
                        panelNewSeries.style["display"] = "block";
                    }
                }
                else {
                    if (panelNewSeries != null) {
                        panelNewSeries.style["display"] = "none";
                    }
                }
            }

            function ddSermonSeriesUpd_SelectedIndexChanged(sender) {
                var panelNewSeries = document.getElementById('<%= panelNewSeries.ClientID %>');
                if (sender.value == "AddNew") {
                    if (panelNewSeries != null) {
                        panelNewSeries.style["display"] = "block";
                    }
                }
                else {
                    if (panelNewSeries != null) {
                        panelNewSeries.style["display"] = "none";
                    }
                }
            }

            function SeriesCoverstory_ClientLoad(oRotator, args) {
                oRotator.stop();
            }

            function SeriesCoverstory_ClientItemClicked(oRotator, args) {
                oRotator.set_currentItemIndex(args.get_item().get_index(), true);
            }
        </script>
    </telerik:RadCodeBlock>
    <div class="leftnav">
        <div style="margin: 11px 0px 25px 0px;"><asp:Image runat="server" ImageUrl="~/Images/sectionTitleWorship.png" /></div>
        <telerik:RadMenu ID="radMenuLeftNav" runat="server" EnableEmbeddedSkins="false" 
            Skin="ANMCLeftNav" OnItemClick="radMenuLeftNav_ItemClick">
            <Items>
                <telerik:RadMenuItem Text="말씀" Value="SundaySermon" Selected="true"></telerik:RadMenuItem>
                <telerik:RadMenuItem Text="찬양" Value="SundayPraise"></telerik:RadMenuItem>
                <telerik:RadMenuItem Text="특별집회" Value="SpecialEvents"></telerik:RadMenuItem>
                <telerik:RadMenuItem Text="Add video" Value="AddVideo"></telerik:RadMenuItem>
                <telerik:RadMenuItem Text="Manage video" Value="ManageVideo"></telerik:RadMenuItem>
            </Items>
        </telerik:RadMenu>
    </div>
    <div class="rightcontentarea">
        <div id="contentBoxHolder">
            <telerik:RadMultiPage ID="ANMCPageViews" runat="server" RenderSelectedPageOnly="true" SelectedIndex="0">
                <telerik:RadPageView ID="viewVideoList" runat="server">
                    <div class="ContentTitleBar">
                        <asp:Image ID="imgTitleList" runat="server" ImageUrl="~/Images/titlebar_worship.png" />
                    </div>
                    <telerik:RadRotator ID="SeriesCoverstory" runat="server" Width="696px" ItemWidth="200px" Height="250px" 
                        ItemHeight="150" SlideShowAnimation-Type="None" RotatorType="CoverFlow" OnClientLoad="SeriesCoverstory_ClientLoad" OnClientItemClicked="SeriesCoverstory_ClientItemClicked">
                        <ItemTemplate>
                            <asp:Image runat="server" ImageUrl='<%# string.Format("~/Images/SermonSeries/{0}", Eval("series_image_url")) %>' Width="200" />
                        </ItemTemplate>
                    </telerik:RadRotator>
                    <telerik:RadGrid ID="gridSermon" runat="server" Skin="Metro" AllowSorting="true" AllowPaging="true" PageSize="10">
                        <MasterTableView AutoGenerateColumns="false">
                            <Columns>
                                <telerik:GridTemplateColumn HeaderStyle-Width="95px">
                                    <ItemTemplate>
                                        <asp:LinkButton ID="lnkSermonDetail" runat="server" CommandArgument='<%# Eval("sermon_id") %>' OnClick="lnkSermonDetail_Click"><%# GetVideoLink(Eval("Youtube_url")) %></asp:LinkButton>
                                    </ItemTemplate>
                                </telerik:GridTemplateColumn>
                                <telerik:GridBoundColumn HeaderStyle-Width="80px" DataField="preached_dttm" DataFormatString="{0:d}" HeaderText="날짜" />
                                <telerik:GridBoundColumn DataField="title_txt" HeaderText="제목" />
                                <telerik:GridBoundColumn DataField="reference_txt" HeaderText="본문" />
                                <telerik:GridBoundColumn DataField="series_nm" HeaderText="시리즈" />
                            </Columns>
                        </MasterTableView>
                    </telerik:RadGrid>
                </telerik:RadPageView>
                <telerik:RadPageView ID="viewVideoDetail" runat="server">
                    <div class="ContentTitleBar">
                        <asp:Image ID="imgTitleDetail" runat="server" ImageUrl="~/Images/titlebar_worship.png" />
                    </div>
                    <div style="margin: 15px;">
                        <div style="margin-top: 25px">
                            <div style="float: left; margin-left: 5px;"><asp:Label runat="server" ID="lblSermonTitle" Font-Bold="true" Font-Size="Medium" /></div>
                            <div style="float: right; margin-right: 5px;"><asp:Label ID="lblSermonDateTime" runat="server" /></div>
                            <div style="clear: both;"></div>
                            <div style="border: 1px solid #e5e5e5; margin-left: 2px; margin-top: 5px; padding: 10px 25px;">
                                <div class="SermonReference"><asp:Label ID="lblReferenceTxt" runat="server" /></div>
                                <div class="SermonPassage"><asp:Label ID="lblPassageTxt" runat="server" /></div>
                                <asp:Panel ID="panelDownloadLink" runat="server" CssClass="SermonPassage"><asp:LinkButton ID="lnkDownloadVideoFile" runat="server" Text="[비디오가 보이시지 않으시면 여기를 클릭하세요.]" OnClick="lnkDownloadVideoFile_Click" /></asp:Panel>
                                <asp:PlaceHolder ID="pldYouTubeVideo" runat="server" />
                            </div>
                        </div>
                    </div>
                </telerik:RadPageView>
                <telerik:RadPageView ID="viewAddVideo" runat="server">
                    <div class="ContentTitleBar">
                        <asp:Image ID="Image3" runat="server" ImageUrl="~/Images/titlebar_worship.png" />
                    </div>
                    <asp:HiddenField ID="hidSermonId" runat="server" />
                    <table cellpadding="0" cellspacing="0" border="0">
                        <tr>
                            <td style="padding: 4px;">&nbsp;</td>
                            <td style="padding: 4px;">
                                <asp:DropDownList ID="ddVideoType" runat="server">
                                    <asp:ListItem Text="설교" Value="1" />
                                    <asp:ListItem Text="찬양" Value="2" />
                                    <asp:ListItem Text="특별집회" Value="3" />
                                </asp:DropDownList></td>
                        </tr>
                        <tr>
                            <td style="padding: 4px;">제목:</td>
                            <td style="padding: 4px;"><asp:TextBox ID="txtTitle" runat="server" CssClass="FieldR2" Width="400px" /></td>
                        </tr>
                        <tr>
                            <td style="padding: 4px;">본문:</td>
                            <td style="padding: 4px;"><asp:TextBox ID="txtReference" runat="server" CssClass="FieldR2" Width="400px" /></td>
                        </tr>
                        <tr>
                            <td style="padding: 4px; vertical-align: top; padding-top: 10px;">시리즈:</td>
                            <td style="padding: 4px;">
                                <asp:DropDownList ID="ddSermonSeries" runat="server" onchange="ddSermonSeries_SelectedIndexChanged(this)" DataSourceID="dsSermonSeries" DataTextField="series_nm" DataValueField="sermon_series_id" AppendDataBoundItems="true">
                                    <asp:ListItem Text="N/A" Value="" />
                                    <asp:ListItem Text="Add new series" Value="AddNew" />
                                </asp:DropDownList>
                                <asp:Panel ID="panelNewSeries" runat="server" style="display: none;">
                                    <table>
                                        <tr>
                                            <td style="padding: 4px;">시리즈 제목:</td>
                                            <td style="padding: 4px;"><asp:TextBox ID="txtSeriesNm" runat="server" /></td>
                                        </tr>
                                        <tr>
                                            <td style="padding: 4px;">시리즈 요약:</td>
                                            <td style="padding: 4px;"><asp:TextBox ID="txtSeriesDetailTxt" runat="server" TextMode="MultiLine" Rows="3" Width="300px" /></td>
                                        </tr>
                                        <tr>
                                            <td style="padding: 4px;">시리즈 그림:</td>
                                            <td style="padding: 4px;"><telerik:RadAsyncUpload ID="fuSeriesImage" runat="server" MaxFileInputsCount="1" /></td>
                                        </tr>
                                    </table>
                                </asp:Panel>
                        </tr>
                        <tr>
                            <td style="padding: 4px;">설교요약:</td>
                            <td style="padding: 4px;"><asp:TextBox ID="txtPassage" runat="server" CssClass="FieldR2" Rows="5" Width="400px" TextMode="MultiLine" /></td>
                        </tr>
                        <tr>
                            <td style="padding: 4px;">날짜:</td>
                            <td style="padding: 4px;"><telerik:RadDateTimePicker ID="RadDateTimePickerPreachedDttm" runat="server" Width="200px" /></td>
                        </tr>
                        <tr>
                            <td style="padding: 4px;">설교자:</td>
                            <td style="padding: 4px;"><asp:TextBox ID="txtPreacherTxt" runat="server" CssClass="FieldR2" Width="200px" Text="양춘호 목사" /></td>
                        </tr>
                        <tr>
                            <td style="padding: 4px;">YouTube URL:</td>
                            <td style="padding: 4px;"><asp:TextBox ID="txtYouTubeUrl" runat="server" CssClass="FieldR2" Width="400px" /></td>
                        </tr>
                        <tr>
                            <td style="padding: 4px;">Video Filename:</td>
                            <td style="padding: 4px;"><asp:TextBox ID="txtDownloadFilenameTxt" runat="server" CssClass="FieldR2" Width="400px" /></td>
                        </tr>
                        <tr>
                            <td style="padding: 4px;">&nbsp;</td>
                            <td style="padding: 4px;">
                                <asp:Button ID="btSaveVideo" runat="server" Text="Submit" OnClick="btSaveVideo_Click" />
                            </td>
                        </tr>
                    </table>
                </telerik:RadPageView>
                <telerik:RadPageView ID="viewManageVideo" runat="server">
                    <div class="ContentTitleBar">
                        <asp:Image ID="Image4" runat="server" ImageUrl="~/Images/titlebar_worship.png" />
                    </div>
                    <telerik:RadGrid ID="gridSermonManager" runat="server" Skin="Metro" AllowSorting="true" AllowPaging="true" PageSize="10" OnUpdateCommand="gridSermonManager_UpdateCommand">
                        <MasterTableView AutoGenerateColumns="false" DataKeyNames="sermon_id" EditMode="EditForms">
                            <Columns>
                                <telerik:GridEditCommandColumn ButtonType="ImageButton" />
                                <telerik:GridTemplateColumn HeaderStyle-Width="95px">
                                    <ItemTemplate>
                                        <asp:LinkButton ID="lnkSermonDetail" runat="server" CommandArgument='<%# Eval("sermon_id") %>' OnClick="lnkSermonDetail_Click"><%# GetVideoLink(Eval("Youtube_url")) %></asp:LinkButton>
                                    </ItemTemplate>
                                </telerik:GridTemplateColumn>
                                <telerik:GridBoundColumn HeaderStyle-Width="80px" DataField="preached_dttm" DataFormatString="{0:d}" HeaderText="날짜" />
                                <telerik:GridBoundColumn DataField="title_txt" HeaderText="제목" />
                                <telerik:GridBoundColumn DataField="reference_txt" HeaderText="본문" />
                                <telerik:GridBoundColumn DataField="series_nm" HeaderText="시리즈" />
                                <telerik:GridTemplateColumn>
                                    <ItemTemplate>
                                        <asp:LinkButton ID="lnkDeleteSermon" runat="server" Text="Delete" CommandArgument='<%# Eval("sermon_id") %>' OnClientClick="if (!confirm('You are about to delete a video, click OK to continue.')) return false;" OnClick="lnkDeleteSermon_Click" />
                                    </ItemTemplate>
                                </telerik:GridTemplateColumn>
                            </Columns>
                            <EditFormSettings EditFormType="Template">
                                <FormTemplate>
                                    <table cellpadding="0" cellspacing="0" border="0">
                                        <tr>
                                            <td style="padding: 4px;">&nbsp;</td>
                                            <td style="padding: 4px;">
                                                <asp:DropDownList ID="ddVideoType" runat="server" SelectedValue='<%# Bind("video_type_id") %>'>
                                                    <asp:ListItem Text="설교" Value="1" />
                                                    <asp:ListItem Text="찬양" Value="2" />
                                                    <asp:ListItem Text="특별집회" Value="3" />
                                                </asp:DropDownList></td>
                                        </tr>
                                        <tr>
                                            <td style="padding: 4px;">제목:</td>
                                            <td style="padding: 4px;"><asp:TextBox ID="txtTitle" runat="server" Text='<%# Bind("title_txt") %>' CssClass="FieldR2" Width="400px" /></td>
                                        </tr>
                                        <tr>
                                            <td style="padding: 4px;">본문:</td>
                                            <td style="padding: 4px;"><asp:TextBox ID="txtReference" runat="server" Text='<%# Bind("reference_txt") %>' CssClass="FieldR2" Width="400px" /></td>
                                        </tr>
                                        <tr>
                                            <td style="padding: 4px; vertical-align: top; padding-top: 10px;">시리즈:</td>
                                            <td style="padding: 4px;">
                                                <asp:DropDownList ID="ddSermonSeries" runat="server" SelectedValue='<%# Bind("sermon_series_id") %>' onchange="ddSermonSeriesUpd_SelectedIndexChanged(this)" DataSourceID="dsSermonSeries" DataTextField="series_nm" DataValueField="sermon_series_id" AppendDataBoundItems="true">
                                                    <asp:ListItem Text="N/A" Value="" />
                                                    <asp:ListItem Text="Add new series" Value="AddNew" />
                                                </asp:DropDownList>
                                                <asp:Panel ID="panelNewSeriesUpd" runat="server" style="display: none;">
                                                    <table>
                                                        <tr>
                                                            <td style="padding: 4px;">시리즈 제목:</td>
                                                            <td style="padding: 4px;"><asp:TextBox ID="txtSeriesNm" runat="server" /></td>
                                                        </tr>
                                                        <tr>
                                                            <td style="padding: 4px;">시리즈 요약:</td>
                                                            <td style="padding: 4px;"><asp:TextBox ID="txtSeriesDetailTxt" runat="server" TextMode="MultiLine" Rows="3" Width="300px" /></td>
                                                        </tr>
                                                        <tr>
                                                            <td style="padding: 4px;">시리즈 그림:</td>
                                                            <td style="padding: 4px;"><telerik:RadAsyncUpload ID="fuSeriesImage" runat="server" MaxFileInputsCount="1" /></td>
                                                        </tr>
                                                    </table>
                                                </asp:Panel>
                                        </tr>
                                        <tr>
                                            <td style="padding: 4px;">설교요약:</td>
                                            <td style="padding: 4px;"><asp:TextBox ID="txtPassage" runat="server" Text='<%# Bind("passage_txt") %>' CssClass="FieldR2" Rows="5" Width="400px" TextMode="MultiLine" /></td>
                                        </tr>
                                        <tr>
                                            <td style="padding: 4px;">날짜:</td>
                                            <td style="padding: 4px;"><telerik:RadDateTimePicker ID="RadDateTimePickerPreachedDttm" runat="server" SelectedDate='<%# Bind("preached_dttm") %>' Width="200px" /></td>
                                        </tr>
                                        <tr>
                                            <td style="padding: 4px;">설교자:</td>
                                            <td style="padding: 4px;"><asp:TextBox ID="txtPreacherTxt" runat="server" Text='<%# Bind("preacher_nm") %>' CssClass="FieldR2" Width="200px" /></td>
                                        </tr>
                                        <tr>
                                            <td style="padding: 4px;">YouTube URL:</td>
                                            <td style="padding: 4px;"><asp:TextBox ID="txtYouTubeUrl" runat="server" Text='<%# Bind("Youtube_url") %>' CssClass="FieldR2" Width="400px" /></td>
                                        </tr>
                                        <tr>
                                            <td style="padding: 4px;">Video Filename:</td>
                                            <td style="padding: 4px;"><asp:TextBox ID="txtDownloadFilenameTxt" runat="server" Text='<%# Bind("download_filename_txt") %>' CssClass="FieldR2" Width="400px" /></td>
                                        </tr>
                                        <tr>
                                            <td style="padding: 4px;">&nbsp;</td>
                                            <td style="padding: 4px;">
                                                <asp:Button ID="btSaveVideoUpdated" runat="server" Text="Save" CommandName="Update" />
                                                <asp:Button ID="btCancelUpdate" runat="server" Text="Cancel" CausesValidation="False" CommandName="Cancel" />
                                            </td>
                                        </tr>
                                    </table>
                                </FormTemplate>
                            </EditFormSettings>
                        </MasterTableView>
                    </telerik:RadGrid>
                </telerik:RadPageView>
            </telerik:RadMultiPage>
            <asp:SqlDataSource ID="dsSermonSeries" runat="server" ConnectionString='<%$ ConnectionStrings:DbConn %>' SelectCommand="proc_cm_ListSermonSeries" SelectCommandType="StoredProcedure"></asp:SqlDataSource>
        </div>
        <div style="clear: both;"></div>
    </div>
    <div style="clear: both;"></div>
</asp:Content>
